﻿/**
 * @file NisSpeedLimit_Struct.h
 * @brief NisSpeedLimit
 * @details 
 * @mainpage http://www.navinfo.com/
 * @author Navinfo
 * @email 400-810-0880
 * @license Navinfo Co.,Ltd. All rights reserved
 */
#ifndef	__NISSPEEDLIMITSTRUCT_H_
#define	__NISSPEEDLIMITSTRUCT_H_

PRAGMA_PACK_PUSH

namespace Navinfo {
namespace Nis {

class CSpeedLimitFlag;
class CFixedSpeedLimit;
class CFixedSpeedLimitList;
class CCondSpeedLimitFlag;
class CWeather;
class CFuzzyTimeDomain;
class CCondSpeedLimit;
class CCondSpeedLimitList;
class CVariableSpeedLimitFlag;
class CVariableSpeedLimit;
class CVariableSpeedLimitList;

/**
 * @brief SPEED_LIMIT_SOURCE
 * 
 */
enum SPEED_LIMIT_SOURCE {
	SPEED_LIMIT_SOURCE_REAL_SPEED,	///<	真实的限速值
	SPEED_LIMIT_SOURCE_THEORETICAL_SPEED,	///<	理论推断的限速值
	SPEED_LIMIT_SOURCE_NOT_APPLICABLE,	///<	限速值不适用
};
/**
 * @brief WEATHER
 * 
 */
enum WEATHER {
	WEATHER_SNOW,	///<	雪天
	WEATHER_RAIN,	///<	雨天
	WEATHER_FOG,	///<	雾天
};


/**
 * @brief SpeedLimitFlag
 * 
 */
class DLL_PUBLIC CSpeedLimitFlag
{
public:
	CSpeedLimitFlag();

	explicit CSpeedLimitFlag(
		uchar v_ 
		);

public:
	/**
	 * @brief 取得MinSpeedFlag
	 * @details 
	 *
	 * @return 是否有最小限速值
	 */
	Navinfo::Nis::BOOL GetMinSpeedFlag() const;

	/**
	 * @brief 取得LinearRangeFlag
	 * @details 
	 *
	 * @return 是否有线性区间范围
	 */
	Navinfo::Nis::BOOL GetLinearRangeFlag() const;


public:
	union {
		uchar													v;
		struct {
			uchar												m_ucMinSpeedFlag			: 1;			///<	  是否有最小限速值  
			uchar												m_ucLinearRangeFlag			: 1;			///<	  是否有线性区间范围  
		};
	};
};


/**
 * @brief 固定限速
 * 
 */
class DLL_PUBLIC CFixedSpeedLimit
{
public:
	CFixedSpeedLimit();

	explicit CFixedSpeedLimit(
		  const CSpeedLimitFlag &m_clFlag_
		, const uchar &m_ucMaxSpeed_ = 0
		, const uchar &m_ucMaxSpeedSource_ = 0
		, const uchar &m_ucMinSpeed_ = 0
		, const uchar &m_ucMinSpeedSource_ = 0
		, const Navinfo::Nis::CLinearRange &m_clLinearRange_ = Navinfo::Nis::CLinearRange()
		);

public:
	/**
	 * @brief 取得Flag
	 *
	 * @return Flag
	 */
	const CSpeedLimitFlag& GetFlag() const;

	/**
	 * @brief 取得LinearRange
	 *
	 * @return 线性区间范围
	 */
	const Navinfo::Nis::CLinearRange& GetLinearRange() const;

	/**
	 * @brief 取得MaxSpeed
	 *
	 * @return 最大限速值，单位为 km/h
	 */
	const uchar& GetMaxSpeed() const;

	/**
	 * @brief 取得MaxSpeedSource
	 *
	 * @return 最大限速值的来源，包括真实的限速值和理论推断的限速值
	 */
	SPEED_LIMIT_SOURCE GetMaxSpeedSource() const;

	/**
	 * @brief 取得MinSpeed
	 *
	 * @return 最小限速值，单位为 km/h
	 */
	const uchar& GetMinSpeed() const;

	/**
	 * @brief 取得MinSpeedSource
	 *
	 * @return 最小限速值的来源，包括真实的限速值和理论推断的限速值
	 */
	SPEED_LIMIT_SOURCE GetMinSpeedSource() const;


public:
	CSpeedLimitFlag												m_clFlag;									///<	  Flag  
	Navinfo::Nis::CLinearRange									m_clLinearRange;							///<	  线性区间范围  
	uchar														m_ucMaxSpeed;								///<	  最大限速值，单位为 km/h  
	uchar														m_ucMaxSpeedSource;							///<	  最大限速值的来源，包括真实的限速值和理论推断的限速值  
	uchar														m_ucMinSpeed;								///<	  最小限速值，单位为 km/h  
	uchar														m_ucMinSpeedSource;							///<	  最小限速值的来源，包括真实的限速值和理论推断的限速值  
};


/**
 * @brief 固定限速列表
 * 
 */
class DLL_PUBLIC CFixedSpeedLimitList
{
public:
	CFixedSpeedLimitList();

	explicit CFixedSpeedLimitList(
		  const vector< CFixedSpeedLimit > &m_vclFixedSpeedLimitList_
		);

public:
	/**
	 * @brief 取得FixedSpeedLimitList的数量
	 *
	 * @return FixedSpeedLimitList的数量
	 */
	size_t GetNumFixedSpeedLimitList() const;

	/**
	 * @brief 取得数组FixedSpeedLimitList中下标为iNo的元素
	 * @details 
	 *
	 * @return FixedSpeedLimitList
	 */
	const CFixedSpeedLimit& GetFixedSpeedLimitList( size_t iNo ) const;

	/**
	 * @brief 取得FixedSpeedLimitList
	 *
	 * @return FixedSpeedLimitList
	 */
	const vector< CFixedSpeedLimit >& GetFixedSpeedLimitList() const;


public:
	vector< CFixedSpeedLimit >									m_vclFixedSpeedLimitList;					///<	  FixedSpeedLimitList  
};


/**
 * @brief CondSpeedLimitFlag
 * 
 */
class DLL_PUBLIC CCondSpeedLimitFlag
{
public:
	CCondSpeedLimitFlag();

	explicit CCondSpeedLimitFlag(
		ushort v_ 
		);

public:
	/**
	 * @brief 取得LinearRangeFlag
	 * @details 
	 *
	 * @return 是否有线性区间范围
	 */
	Navinfo::Nis::BOOL GetLinearRangeFlag() const;

	/**
	 * @brief 取得PublicServiceVechilesFlag
	 * @details 
	 *
	 * @return 是否存在公共服务车辆限制
	 */
	ushort GetPublicServiceVechilesFlag() const;

	/**
	 * @brief 取得AuthorizationFlag
	 * @details 
	 *
	 * @return 是否存在授权道路
	 */
	ushort GetAuthorizationFlag() const;

	/**
	 * @brief 取得FuzzyTimeDomainFlag
	 * @details 
	 *
	 * @return 是否有模糊时间条件
	 */
	Navinfo::Nis::BOOL GetFuzzyTimeDomainFlag() const;

	/**
	 * @brief 取得IsDerivedFlag
	 * @details 
	 *
	 * @return 限速值是否衍生的，即在数据编译或源数据创建期间计算得出，不是路标上的限速值
	 */
	Navinfo::Nis::BOOL GetIsDerivedFlag() const;

	/**
	 * @brief 取得DaysOfWeekFlag
	 * @details 
	 *
	 * @return 是否有以日、周来描述的时间范围
	 */
	Navinfo::Nis::BOOL GetDaysOfWeekFlag() const;

	/**
	 * @brief 取得TimeRangeOfDayFlag
	 * @details 
	 *
	 * @return 是否有以小时、分来描述的时间范围
	 */
	Navinfo::Nis::BOOL GetTimeRangeOfDayFlag() const;

	/**
	 * @brief 取得FrequentlyUsedVehicleTypesFlag
	 * @details 
	 *
	 * @return 是否有车辆类型
	 */
	Navinfo::Nis::BOOL GetFrequentlyUsedVehicleTypesFlag() const;

	/**
	 * @brief 取得WeatherFlag
	 * @details 
	 *
	 * @return 是否有天气因素
	 */
	Navinfo::Nis::BOOL GetWeatherFlag() const;


public:
	union {
		ushort													v;
		struct {
			ushort												m_ucLinearRangeFlag			: 1;			///<	  是否有线性区间范围  
			ushort												m_ucPublicServiceVechilesFlag	: 1;		///<	  是否存在公共服务车辆限制  
			ushort												m_ucAuthorizationFlag		: 1;			///<	  是否存在授权道路  
			ushort												m_ucFuzzyTimeDomainFlag		: 1;			///<	  是否有模糊时间条件  
			ushort												m_ucIsDerivedFlag			: 1;			///<	  限速值是否衍生的，即在数据编译或源数据创建期间计算得出，不是路标上的限速值  
			ushort												m_ucDaysOfWeekFlag			: 1;			///<	  是否有以日、周来描述的时间范围  
			ushort												m_ucTimeRangeOfDayFlag		: 1;			///<	  是否有以小时、分来描述的时间范围  
			ushort												m_ucFrequentlyUsedVehicleTypesFlag	: 1;	///<	  是否有车辆类型  
			ushort												m_ucWeatherFlag				: 1;			///<	  是否有天气因素  
		};
	};
};


/**
 * @brief 天气
 * 
 */
class DLL_PUBLIC CWeather
{
public:
	CWeather();

	explicit CWeather(
		ushort v_ 
		);

public:
	/**
	 * @brief 取得IsInclusive
	 * @details 
	 *
	 * @return 如果设置为true，则指定的天气值有效。否则，相反的值有效
	 */
	Navinfo::Nis::BOOL GetIsInclusive() const;

	/**
	 * @brief 取得Weather
	 * @details 
	 *
	 * @return 天气类型
	 */
	WEATHER GetWeather() const;


public:
	union {
		ushort													v;
		struct {
			ushort												m_ucIsInclusive				: 1;			///<	  如果设置为true，则指定的天气值有效。否则，相反的值有效  
			ushort												m_ucWeather					: 8;			///<	  天气类型  
		};
	};
};


/**
 * @brief 模糊时间域
 * 
 */
class DLL_PUBLIC CFuzzyTimeDomain
{
public:
	CFuzzyTimeDomain();

	explicit CFuzzyTimeDomain(
		uchar v_ 
		);

public:
	/**
	 * @brief 取得IsInclusive
	 * @details 
	 *
	 * @return 如果设置为真，则指定的模糊值有效。否则相反的值有效
	 */
	Navinfo::Nis::BOOL GetIsInclusive() const;

	/**
	 * @brief 取得FuzzyTime
	 * @details 
	 *
	 * @return 定义的模糊时间
	 */
	Navinfo::Nis::FUZZY_TIME_DOMAIN GetFuzzyTime() const;


public:
	union {
		uchar													v;
		struct {
			uchar												m_ucIsInclusive				: 1;			///<	  如果设置为真，则指定的模糊值有效。否则相反的值有效  
			uchar												m_ucFuzzyTime				: 6;			///<	  定义的模糊时间  
		};
	};
};


/**
 * @brief 条件限速
 * 
 */
class DLL_PUBLIC CCondSpeedLimit
{
public:
	CCondSpeedLimit();

	explicit CCondSpeedLimit(
		  const CCondSpeedLimitFlag &m_clFlag_
		, const uchar &m_ucSpeed_ = 0
		, const uchar &m_ucIsDerived_ = 0
		, const Navinfo::Nis::CLinearRange &m_clLinearRange_ = Navinfo::Nis::CLinearRange()
		, const CWeather &m_clWeather_ = CWeather()
		, const Navinfo::Nis::CFrequentlyUsedVehicleTypes &m_clFrequentlyUsedVehicleTypes_ = Navinfo::Nis::CFrequentlyUsedVehicleTypes()
		, const Navinfo::Nis::CTimeRangeOfDay &m_clTimeRangeOfDay_ = Navinfo::Nis::CTimeRangeOfDay()
		, const Navinfo::Nis::CDaysOfWeek &m_clDaysOfWeek_ = Navinfo::Nis::CDaysOfWeek()
		, const CFuzzyTimeDomain &m_clFuzzyTimeDomain_ = CFuzzyTimeDomain()
		, const Navinfo::Nis::CAuthorization &m_clAuthorization_ = Navinfo::Nis::CAuthorization()
		, const Navinfo::Nis::CPublicServiceVehicles &m_clPublicServiceVehicles_ = Navinfo::Nis::CPublicServiceVehicles()
		);

public:
	/**
	 * @brief 取得Flag
	 *
	 * @return Flag
	 */
	const CCondSpeedLimitFlag& GetFlag() const;

	/**
	 * @brief 取得LinearRange
	 *
	 * @return LinearRange
	 */
	const Navinfo::Nis::CLinearRange& GetLinearRange() const;

	/**
	 * @brief 取得Weather
	 *
	 * @return 天气情况，例如当道路上有雾时才适用的速度限制
	 */
	const CWeather& GetWeather() const;

	/**
	 * @brief 取得FrequentlyUsedVehicleTypes
	 *
	 * @return 车辆类型
	 */
	const Navinfo::Nis::CFrequentlyUsedVehicleTypes& GetFrequentlyUsedVehicleTypes() const;

	/**
	 * @brief 取得TimeRangeOfDay
	 *
	 * @return 以小时、分来描述时间范围，包括起始时间、 结束时间
	 */
	const Navinfo::Nis::CTimeRangeOfDay& GetTimeRangeOfDay() const;

	/**
	 * @brief 取得DaysOfWeek
	 *
	 * @return 以日、周来描述时间范围，包括起始日期、 结束日期
	 */
	const Navinfo::Nis::CDaysOfWeek& GetDaysOfWeek() const;

	/**
	 * @brief 取得FuzzyTimeDomain
	 *
	 * @return 该属性描述了如高峰期、夏季等模糊的时间条件 
	 */
	const CFuzzyTimeDomain& GetFuzzyTimeDomain() const;

	/**
	 * @brief 取得Authorization
	 *
	 * @return 与授权相结合的条件规制，如禁止通行等
	 */
	const Navinfo::Nis::CAuthorization& GetAuthorization() const;

	/**
	 * @brief 取得PublicServiceVehicles
	 *
	 * @return 与任何限制（如禁止通行等）相结合的公共服务车辆条件。
	 */
	const Navinfo::Nis::CPublicServiceVehicles& GetPublicServiceVehicles() const;

	/**
	 * @brief 取得Speed
	 *
	 * @return 限速值 单位为km/h
	 */
	const uchar& GetSpeed() const;

	/**
	 * @brief 取得IsDerived
	 *
	 * @return 限速值是否衍生的，即在数据编译或源数据创建期间计算得出，不是路标上的限速值
	 */
	const uchar& GetIsDerived() const;


public:
	CCondSpeedLimitFlag											m_clFlag;									///<	  Flag  
	Navinfo::Nis::CLinearRange									m_clLinearRange;							///<	  LinearRange  
	CWeather													m_clWeather;								///<	  天气情况，例如当道路上有雾时才适用的速度限制  
	Navinfo::Nis::CFrequentlyUsedVehicleTypes					m_clFrequentlyUsedVehicleTypes;				///<	  车辆类型  
	Navinfo::Nis::CTimeRangeOfDay								m_clTimeRangeOfDay;							///<	  以小时、分来描述时间范围，包括起始时间、 结束时间  
	Navinfo::Nis::CDaysOfWeek									m_clDaysOfWeek;								///<	  以日、周来描述时间范围，包括起始日期、 结束日期  
	CFuzzyTimeDomain											m_clFuzzyTimeDomain;						///<	  该属性描述了如高峰期、夏季等模糊的时间条件   
	Navinfo::Nis::CAuthorization								m_clAuthorization;							///<	  与授权相结合的条件规制，如禁止通行等  
	Navinfo::Nis::CPublicServiceVehicles						m_clPublicServiceVehicles;					///<	  与任何限制（如禁止通行等）相结合的公共服务车辆条件。  
	uchar														m_ucSpeed;									///<	  限速值 单位为km/h  
	uchar														m_ucIsDerived;								///<	  限速值是否衍生的，即在数据编译或源数据创建期间计算得出，不是路标上的限速值  
};


/**
 * @brief 条件限速列表
 * 
 */
class DLL_PUBLIC CCondSpeedLimitList
{
public:
	CCondSpeedLimitList();

	explicit CCondSpeedLimitList(
		  const vector< CCondSpeedLimit > &m_vclCondSpeedLimitList_
		);

public:
	/**
	 * @brief 取得CondSpeedLimitList的数量
	 *
	 * @return CondSpeedLimitList的数量
	 */
	size_t GetNumCondSpeedLimitList() const;

	/**
	 * @brief 取得数组CondSpeedLimitList中下标为iNo的元素
	 * @details 
	 *
	 * @return CondSpeedLimitList
	 */
	const CCondSpeedLimit& GetCondSpeedLimitList( size_t iNo ) const;

	/**
	 * @brief 取得CondSpeedLimitList
	 *
	 * @return CondSpeedLimitList
	 */
	const vector< CCondSpeedLimit >& GetCondSpeedLimitList() const;


public:
	vector< CCondSpeedLimit >									m_vclCondSpeedLimitList;					///<	  CondSpeedLimitList  
};


/**
 * @brief VariableSpeedLimitFlag
 * 
 */
class DLL_PUBLIC CVariableSpeedLimitFlag
{
public:
	CVariableSpeedLimitFlag();

	explicit CVariableSpeedLimitFlag(
		uchar v_ 
		);

public:
	/**
	 * @brief 取得LinearRangeFlag
	 * @details 
	 *
	 * @return 是否有线性区间范围
	 */
	Navinfo::Nis::BOOL GetLinearRangeFlag() const;


public:
	union {
		uchar													v;
		struct {
			uchar												m_ucLinearRangeFlag			: 1;			///<	  是否有线性区间范围  
		};
	};
};


/**
 * @brief 可变限速
 * 
 */
class DLL_PUBLIC CVariableSpeedLimit
{
public:
	CVariableSpeedLimit();

	explicit CVariableSpeedLimit(
		  const CVariableSpeedLimitFlag &m_clFlag_
		, const Navinfo::Nis::CLinearRange &m_clLinearRange_ = Navinfo::Nis::CLinearRange()
		);

public:
	/**
	 * @brief 取得Flag
	 *
	 * @return Flag
	 */
	const CVariableSpeedLimitFlag& GetFlag() const;

	/**
	 * @brief 取得LinearRange
	 *
	 * @return 线性区间范围
	 */
	const Navinfo::Nis::CLinearRange& GetLinearRange() const;


public:
	CVariableSpeedLimitFlag										m_clFlag;									///<	  Flag  
	Navinfo::Nis::CLinearRange									m_clLinearRange;							///<	  线性区间范围  
};


/**
 * @brief 可变限速列表
 * 
 */
class DLL_PUBLIC CVariableSpeedLimitList
{
public:
	CVariableSpeedLimitList();

	explicit CVariableSpeedLimitList(
		  const vector< CVariableSpeedLimit > &m_vclVariableSpeedLimitList_
		);

public:
	/**
	 * @brief 取得VariableSpeedLimitList的数量
	 *
	 * @return VariableSpeedLimitList的数量
	 */
	size_t GetNumVariableSpeedLimitList() const;

	/**
	 * @brief 取得数组VariableSpeedLimitList中下标为iNo的元素
	 * @details 
	 *
	 * @return VariableSpeedLimitList
	 */
	const CVariableSpeedLimit& GetVariableSpeedLimitList( size_t iNo ) const;

	/**
	 * @brief 取得VariableSpeedLimitList
	 *
	 * @return VariableSpeedLimitList
	 */
	const vector< CVariableSpeedLimit >& GetVariableSpeedLimitList() const;


public:
	vector< CVariableSpeedLimit >								m_vclVariableSpeedLimitList;				///<	  VariableSpeedLimitList  
};

}
}

PRAGMA_PACK_POP

#endif	//	__NISSPEEDLIMITSTRUCT_H_
